#!/bin/bash

export PATH=/opt/parasoft/cpptest/bin:/opt/parasoft/cpptest:$PATH


root_dir='../'  # 默认根目录

# 检查是否提供了参数，如果提供了，则使用第一个参数作为根目录
if [ -n "$1" ]; then  # -n 检查字符串是否非空
  root_dir="$1"
fi

echo "cd to ${root_dir}"
cd "${root_dir}"

cpptestcli -data "${root_dir}/workspace_cpptest" -localsettings "${root_dir}/script/localsettings.properties" -config "${root_dir}/script/static-MISRA-C-2012.properties" -report "${root_dir}/report_static" -showdetails -appconsole "${root_dir}/stdout.log" -publish 
#-property build.id=${dtp_project}-${time}-test2

cpptestcli -data "${root_dir}/workspace_cpptest" -localsettings "${root_dir}/script/localsettings.properties" -config "${root_dir}/script/Run-Unit-Tests.properties" -report "${root_dir}/report_unit" -showdetails -appconsole "${root_dir}/stdout.log" -publish
